<?php

namespace app\admin\validate\user;

use think\Validate;

class Info extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'user_id' => 'require|unique:user_info',
        'dns' => 'require|ip',
        // 'ip' => 'require|ip|unique:user_info'
        'ip' => 'require|ip'
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'dns.ip' => '请填写规范的dns地址',
        'ip.ip' => '请填写正确的ip地址',
        // 'ip.unique' => 'ip地址已存在'
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => [],
        'edit' => [],
    ];
    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'user_id' => __('User_id')
        ];
        parent::__construct($rules, $message, $field);
    }
}
